<% cache("#{date_slug}/topics/by_department", :tag => 'session-info', expires_in: 1.day)  do %>
  <% @topics = Topic.upcoming.includes(:department) %>
  <% if @topics.blank? %>
    <div class="empty-list">
      <p>Sorry, there are no upcoming sessions at this time. Please check again later!</p>
    </div>
  <% else %>
    <% grouped_by_department(@topics) do |department, topics| %>
      <div class="content-section">
        <h2><%= department.name %></h2>
        <ul class="topic-list">
          <% topics.each do |topic| %>
            <% cache(["#{date_slug}/topics/by_department", topic], :tag => topic.cache_key, expires_in: 1.day) do %>
              <li>
                <%= link_to topic.name, topic %>
                <% if topic.upcoming_sessions.present? %>       
                <% session = topic.upcoming_sessions[0] %>
                <div class="session-info">
                  <span class="session-link"><%= link_to_session session %></span>
                  <%= session_site(session) %>
                </div>
                <% end %>
              </li>
            <% end %>
          <% end %>
        </ul>
      </div>
    <% end %>
  <% end %>
<% end %>
